local name, gotGestures = ...

local displayFrame = CreateFrame("Frame", nil, UIParent)
displayFrame:SetPoint("TOP", 0, -40)
displayFrame:SetSize(10,10)

displayFrame.gesture = displayFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
displayFrame.gesture:SetPoint("TOP")

displayFrame.script = displayFrame:CreateFontString(nil, "OVERLAY", "GameFontGreen")
displayFrame.script:SetPoint("TOP", displayFrame.gesture, "BOTTOM")

gotGestures:Listen("UpdatePath", function(self, event, path)
	if path ~= "" then
		displayFrame.gesture:SetText(path)
		
		local script = self.binds[path]
		displayFrame.script:SetText(script)
		
		if script and self.functions[script] then
			displayFrame.script:SetTextColor(0,1,0)
		else
			displayFrame.script:SetTextColor(1,0,0)
		end
	end
end)

displayFrame:SetScript("OnHide", function(self)
	self.gesture:SetText(nil)
	self.script:SetText(nil)
end)

local function PathListener(self, event)
	if event == "PathStart" then
		displayFrame:Show()
	else
		displayFrame:Hide()
	end
end

gotGestures:Listen("PathStart", PathListener)
gotGestures:Listen("PathStop", PathListener)